virtual bool IsParticleConstraint (void)
Overloaded to define if this constraint is specifically a particle constraint.
Returns
true if it is a particle constraint. In that case you need to overload GetParticleConstraint!
virtual void PrecomputeConstraint (void* t_data)
Overloaded to precompute or allocate any data required when the constraint is sampled.
Make sure you support multiple processors. Constraints are always called in a multiprocessor context.
Parameters
void* t_data:
Currently unused. May contain additional data specific to a constraint.
virtual void FreePrecomputeConstraint (void)
Overloaded to free any precomputed data (in PrecomputeConstraint).
virtual bool GetConstraint (const vector3d& position, double& src_value, void* local_data, int cpu = 0)
Overloaded when your constraint is sampled by other nodes.
This is always called in a multiprocessor context.
Returns
true if sampling was successful and if the src_value is not 0.0! Otherwise return false.
Parameters
const vector3d& position:
Physical position this constraint is sampled for.
double& src_value:
This is the constraint value. This could be the result of several constraints so may not strictly be the explicit constraint value
alone. If you overwrite it and other constraints already operated on it, their constraint value is gone!
Best is to multiply your constraint value with the original value.
Be sure to call Base::GetConstraint().
void* local_data:
Currently unused
int cpu:
The current cpu thread your constraint is called from.
virtual bool GetParticleConstraint (const vector3d& position, double& src_value, void* local_data, int cpu = 0, const void* t_particle = NULL)
Overloaded when your particle constraint is sampled by other nodes.
This is always called in a multiprocessor context.
Returns
true if sampling was successful and if the src_value is not 0.0! Otherwise return false.
Parameters
const vector3d& position:
Physical position this constraint is currently sampled for.
double& src_value:
This is the constraint value. This could be the result of several constraints so may not strictly be the explicit constraint value
alone. If you overwrite it and other constraints already operated on it, their constraint value is gone!
Best is to multiply your constraint value with the original value.
Be sure to call Base::GetConstraint().
void* local_data:
Currently unused
int cpu:
The current cpu thread your constraint is called from.
const void* t_particle:
Contains the FXParticle this constraint should take into account. Only used for particle constraints!